-
Notifications
You must be signed in to change notification settings - Fork 40
sdk/basyx/aas/adapter/xml/xml_serialization.py: Remove code duplication #406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Previously, the method `object_to_xml_element()` in `sdk\basyx\aas\adapter\xml\xml_serialization.py` contained duplicated code from `submodel_element_to_xml()` and `data_element_to_xml()`. This was due to the class hierarchy of the objects being compared in the if statements. For instance, some models inherit from `model.SubmodelElement`. Because of that, the associated objects are checked for in `submodel_element_to_xml()`. With that, any additional check for these objects in `object_to_xml_element()` are redundant. This removes the code duplication. Fixes eclipse-basyx#396
|
I am not sure about basyx-python-sdk/sdk/basyx/aas/adapter/xml/xml_serialization.py Lines 936 to 944 in 6f5e4b8
|
Yes, I fully agree with you that this is ugly, but sadly it is intended. Furthermore, our extra function exists in order to future proofs our implementation a little bit (e.g. when Part 3b with a new |
s-heppner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…on (eclipse-basyx#406) Previously, the method `object_to_xml_element()` in `sdk\basyx\aas\adapter\xml\xml_serialization.py` contained duplicated code from `submodel_element_to_xml()` and `data_element_to_xml()`. This was due to the class hierarchy of the objects being compared in the if statements. For instance, some models inherit from `model.SubmodelElement`. Because of that, the associated objects are checked for in `submodel_element_to_xml()`. With that, any additional check for these objects in `object_to_xml_element()` are redundant. This removes the code duplication. Fixes eclipse-basyx#396
Prepare Release v2.0.0 # Release Notes Version 2.0.0 of the BaSyx-Python SDK comes with a major refactoring of the server and a renewed concept for data persistence. Previously, the server code was split between the `sdk` and `server` packages (due to historic development of the code). Now all the code relevant just for the server is located in `server`, where it belongs. Since this means, some code that was previously in `sdk` is not there anymore, this is a breaking change and warranted the new major release. > [!note] > This release does not have any changes in implemented AAS specification versions. It is the preparotory release in order to get ready for the new versions of the specifications, as well as new features for the SDK, such as Registry and Discovery server. > [!warning] > Due to these major refactorings, there were some backward incompatible changes. Please check the documentation, if you encounter any issues. # Changelog **Notable:** - Backward Incompatible: Refactor server functionality from `sdk` to `server` (See: #388) - Backward Incompatible: Refactor `backend` concept for data persistence (See: #370) - Backward Incompatible: Refactor server `start-up` options (See: #418) - Remove support for Python 3.9 (as it is EoL) (See #433) **Improvements:** - Clarify documentation of running the server with Docker (See: #398) - Document running the server without Docker (See: #403) - Improve XML serialization (See: #406) - Improve server reading of JSON and XML files (See: #408) - Add more utility methods for `Referable` and `Key` handling (See: #410) **Bugfixes:** - Fix type issues found with a new version of `mypy` (See: #399) - Fix parsing of `ConceptDescription`s in the server (See: #420) - Update `pyecma376-2` and `lxml` dependencies (See: #419)
Previously, the method
object_to_xml_element()insdk\basyx\aas\adapter\xml\xml_serialization.pycontained duplicated code fromsubmodel_element_to_xml()anddata_element_to_xml(). This was due to the class hierarchy of the objects being compared in the if statements.For instance, some models inherit from
model.SubmodelElement. Because of that, the associated objects are checked for insubmodel_element_to_xml(). With that, any additional check for these objects inobject_to_xml_element()are redundant.This removes the code duplication.
Fixes #396